package exam;

import exam.bean.Record;
import exam.dao.RecordDao;
import groovyjarjarcommonscli.CommandLineParser;
import nz.net.ultraq.thymeleaf.LayoutDialect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.thymeleaf.TemplateEngine;

import java.util.Random;

/**
 * 项目的启动类
 */
@SpringBootApplication
public class Application {

    /*@Autowired
    private RecordDao recordDao;*/


    @RequestMapping("")
    String home() {
        return "Hello World!";
    }
    public static void main(String[] args) {
        TemplateEngine templateEngine = new TemplateEngine();
        templateEngine.addDialect(new LayoutDialect());
        SpringApplication.run(Application.class, args);
    }

    //@Override
   /* public void run(String... args) throws Exception {
        //做数据

        int total=36794;

        for (int i = 0; i < total; i++) {
            Record record=new Record();
            //用户线程 1-500随机数
            int random500 = (int)(Math.random()*500+1);
            record.setThreadId(random500);

            //耗时   300-1000毫秒以内
            Random rand=new Random();
            int max=1000,min=300;
            record.setTimeRequest(rand.nextInt(max-min+1)+min);

            recordDao.insertRecord(record);
        }

    }*/
}